using System;
using System.Collections;
using System.Web.Management;

namespace Salient.Web.Management
{
    ///<summary>
    ///</summary>
    public sealed class SQLiteWebEventCollection : ReadOnlyCollectionBase
    {
        ///<summary>
        ///</summary>
        ///<param name="events"></param>
        ///<exception cref="ArgumentNullException"></exception>
        public SQLiteWebEventCollection(ICollection events)
        {
            if (events == null)
            {
                throw new ArgumentNullException("events");
            }

            foreach (WebBaseEvent eventRaised in events)
            {
                InnerList.Add(eventRaised);
            }
        }

        internal SQLiteWebEventCollection(WebBaseEvent eventRaised)
        {
            if (eventRaised == null)
            {
                throw new ArgumentNullException("eventRaised");
            }

            InnerList.Add(eventRaised);
        }

        // overloaded collection access methods 
        ///<summary>
        ///</summary>
        ///<param name="index"></param>
        public WebBaseEvent this[int index]
        {
            get
            {
                return (WebBaseEvent)InnerList[index];
            }
        }

        ///<summary>
        ///</summary>
        ///<param name="value"></param>
        ///<returns></returns>
        public int IndexOf(WebBaseEvent value)
        {
            return InnerList.IndexOf(value);
        }

        ///<summary>
        ///</summary>
        ///<param name="value"></param>
        ///<returns></returns>
        public bool Contains(WebBaseEvent value)
        {
            return InnerList.Contains(value);
        }
    }
}